package com.springboot.controller.blog;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.springboot.config.controller.BaseController;
import com.springboot.returndata.dto.blog.BlogUserPageDto;
import com.springboot.returndata.vo.blog.BlogUserVo;
import com.springboot.service.blog.BlogUserService;
import com.springboot.util.enums.RespErrorCode;
import com.springboot.util.http.ResponseBuilder;
import com.springboot.util.http.ResultResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 博客分类 前端控制器
 * </p>
 *
 * @author zyj
 * @since 2023-03-23
 */
@RestController
@RequestMapping("/blogUser")
@Slf4j
@Tag(name = "博客用户")
public class BlogAdminUserController extends BaseController {

    @Resource
    private BlogUserService blogUserService;

    @PostMapping(value = "/pageBlogUser")
    @Operation(description = "获取博客用户列表")
    public ResultResponse<Page<BlogUserVo>> pageBlogSort(@RequestBody BlogUserPageDto blogUserPageDto){
        try {
            Page<BlogUserVo> blogSort = blogUserService.pageBlogUser(blogUserPageDto);
            return ResponseBuilder.successData(blogSort);
        }catch (Exception e){
            log.error("pageBlogSort error", e);
        }
        return ResponseBuilder.errorMessage(RespErrorCode.GET_INFO_NULL.getValue(), RespErrorCode.GET_INFO_NULL.getDescripe());

    }

}

